package org.hugh.space.web.servlet;

import javax.servlet.http.HttpServlet;

import org.hugh.space.business.Business;
import org.hugh.space.dao.Dao;
import org.springframework.web.context.support.WebApplicationContextUtils;


public class BaseSpringServlet extends HttpServlet {

	/**
	 * Default constructor.
	 */
	public BaseSpringServlet() {
		super();
	}

	public Dao getDao() {
		return (Dao) getSpringBean("dao");
	}
	
	public Object getSpringBean(final String name) {
		return WebApplicationContextUtils.getRequiredWebApplicationContext(
				getServletContext()).getBean(name);
	}
	
	public Business getBusiness() {
		return (Business) getSpringBean("business");
	}

}
